package org.example.pack1210;

import org.example.pack1210.bean.Dept;
import org.example.pack1210.bean.Emp;
import org.example.pack1210.dao.Dept2DAO;
import org.example.pack1210.dao.Emp2DAO;

public class App2 {
    private static Emp2DAO e2dao = new Emp2DAO();
    private static Dept2DAO d2dao = new Dept2DAO();

    private static void a() {
        // 获取到员工信息，缺部门信息
        Emp emp = e2dao.findById(7972);
        // 获取该员工的部门信息
        int deptNo = emp.getDeptNo();
        Dept dept = d2dao.findById(deptNo);
        // 将部门信息包装到员工信息中
        emp.setDept(dept);
        System.out.println(emp);
    }

    public static void main(String[] args) {
        a();
    }
}

